<template>
  <div class="home-swiper"  @touchmove.stop="hs()">
      
      <mt-swipe :auto="4000" v-if="isHasMore">
        <mt-swipe-item v-for="(list,idx) in swiper" :key="idx" >
          <a :href="list.trans_url"><img class="max" :src="URL.PIC+list.banner"></a>
        </mt-swipe-item>
      </mt-swipe>
  </div>
</template>

<script>
  import api from "@/fetch/api"
  import Loading from '@/base/loading/loading'
  import {Indicator} from 'mint-ui';
  export default {
    name:"HomeSwipe",
    data(){
      return{
        swiper: [],
        isHasMore:false
      }
    },
    components: {
      Loading
    },
    mounted:function(){
        // 初始化订单
        Indicator.open({
          text: '加载中...',
          spinnerType: 'fading-circle'
        })
        this.getData()
    },
    methods:{
      hs(){
        console.log(666)
      },
      getData: function(){

        const params = {};
        api.indexBannerList(params).then((res) => {
          Indicator.close()
        })
        
          .catch(res => {
            this.isHasMore = true
            this.print(res);
            Indicator.close()
            this.swiper = res.data;
            console.log(this.swiper)
            console.log(333)
          })
      }
    }
  }
</script>


<style lang="stylus" scoped>
    .home-swiper{
        height 5.5rem;
        margin-top 1px;
        img {
            width 100%;
            height 100%;
        }
    }
    .loading{position: absolute;left: 50%;top: 45%;transform: translate(-50%,-50%)}
</style>